package com.androidx.p013lv.base.p014db;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import com.androidx.p013lv.base.bean.NovelHistory;
import com.google.android.exoplayer2.text.ttml.TtmlNode;
import java.util.List;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import org.greenrobot.greendao.internal.DaoConfig;

/* renamed from: com.androidx.lv.base.db.NovelHistoryDao */
public class NovelHistoryDao extends AbstractDao<NovelHistory, Long> {
    public static final String TABLENAME = "NOVEL_HISTORY";
    private final NovelHistory.StringConverter tagListConverter = new NovelHistory.StringConverter();

    /* renamed from: com.androidx.lv.base.db.NovelHistoryDao$Properties */
    public static class Properties {
        public static final Property CoverImg = new Property(1, String.class, "coverImg", false, "COVER_IMG");
        public static final Property FakeLikes = new Property(2, Integer.TYPE, "fakeLikes", false, "FAKE_LIKES");
        public static final Property FakeWatchTimes = new Property(3, Integer.TYPE, "fakeWatchTimes", false, "FAKE_WATCH_TIMES");
        public static final Property FictionId = new Property(4, Integer.TYPE, "fictionId", false, "FICTION_ID");
        public static final Property FictionSpace = new Property(5, Integer.TYPE, "fictionSpace", false, "FICTION_SPACE");
        public static final Property FictionTitle = new Property(6, String.class, "fictionTitle", false, "FICTION_TITLE");
        public static final Property FictionType = new Property(7, Integer.TYPE, "fictionType", false, "FICTION_TYPE");

        /* renamed from: Id */
        public static final Property f178Id = new Property(0, Long.class, TtmlNode.ATTR_ID, true, "_id");
        public static final Property Info = new Property(8, String.class, "info", false, "INFO");
        public static final Property TagList = new Property(9, String.class, "tagList", false, "TAG_LIST");
    }

    /* access modifiers changed from: protected */
    @Override // org.greenrobot.greendao.AbstractDao
    public final boolean isEntityUpdateable() {
        return true;
    }

    public NovelHistoryDao(DaoConfig daoConfig) {
        super(daoConfig);
    }

    public NovelHistoryDao(DaoConfig daoConfig, DaoSession daoSession) {
        super(daoConfig, daoSession);
    }

    public static void createTable(Database database, boolean z) {
        String str = z ? "IF NOT EXISTS " : "";
        database.execSQL("CREATE TABLE " + str + "\"NOVEL_HISTORY\" (\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ,\"COVER_IMG\" TEXT,\"FAKE_LIKES\" INTEGER NOT NULL ,\"FAKE_WATCH_TIMES\" INTEGER NOT NULL ,\"FICTION_ID\" INTEGER NOT NULL ,\"FICTION_SPACE\" INTEGER NOT NULL ,\"FICTION_TITLE\" TEXT,\"FICTION_TYPE\" INTEGER NOT NULL ,\"INFO\" TEXT,\"TAG_LIST\" TEXT);");
    }

    public static void dropTable(Database database, boolean z) {
        StringBuilder sb = new StringBuilder();
        sb.append("DROP TABLE ");
        sb.append(z ? "IF EXISTS " : "");
        sb.append("\"NOVEL_HISTORY\"");
        database.execSQL(sb.toString());
    }

    /* access modifiers changed from: protected */
    public final void bindValues(DatabaseStatement databaseStatement, NovelHistory novelHistory) {
        databaseStatement.clearBindings();
        Long id = novelHistory.getId();
        if (id != null) {
            databaseStatement.bindLong(1, id.longValue());
        }
        String coverImg = novelHistory.getCoverImg();
        if (coverImg != null) {
            databaseStatement.bindString(2, coverImg);
        }
        databaseStatement.bindLong(3, (long) novelHistory.getFakeLikes());
        databaseStatement.bindLong(4, (long) novelHistory.getFakeWatchTimes());
        databaseStatement.bindLong(5, (long) novelHistory.getFictionId());
        databaseStatement.bindLong(6, (long) novelHistory.getFictionSpace());
        String fictionTitle = novelHistory.getFictionTitle();
        if (fictionTitle != null) {
            databaseStatement.bindString(7, fictionTitle);
        }
        databaseStatement.bindLong(8, (long) novelHistory.getFictionType());
        String info = novelHistory.getInfo();
        if (info != null) {
            databaseStatement.bindString(9, info);
        }
        List<String> tagList = novelHistory.getTagList();
        if (tagList != null) {
            databaseStatement.bindString(10, this.tagListConverter.convertToDatabaseValue(tagList));
        }
    }

    /* access modifiers changed from: protected */
    public final void bindValues(SQLiteStatement sQLiteStatement, NovelHistory novelHistory) {
        sQLiteStatement.clearBindings();
        Long id = novelHistory.getId();
        if (id != null) {
            sQLiteStatement.bindLong(1, id.longValue());
        }
        String coverImg = novelHistory.getCoverImg();
        if (coverImg != null) {
            sQLiteStatement.bindString(2, coverImg);
        }
        sQLiteStatement.bindLong(3, (long) novelHistory.getFakeLikes());
        sQLiteStatement.bindLong(4, (long) novelHistory.getFakeWatchTimes());
        sQLiteStatement.bindLong(5, (long) novelHistory.getFictionId());
        sQLiteStatement.bindLong(6, (long) novelHistory.getFictionSpace());
        String fictionTitle = novelHistory.getFictionTitle();
        if (fictionTitle != null) {
            sQLiteStatement.bindString(7, fictionTitle);
        }
        sQLiteStatement.bindLong(8, (long) novelHistory.getFictionType());
        String info = novelHistory.getInfo();
        if (info != null) {
            sQLiteStatement.bindString(9, info);
        }
        List<String> tagList = novelHistory.getTagList();
        if (tagList != null) {
            sQLiteStatement.bindString(10, this.tagListConverter.convertToDatabaseValue(tagList));
        }
    }

    @Override // org.greenrobot.greendao.AbstractDao
    public Long readKey(Cursor cursor, int i) {
        int i2 = i + 0;
        if (cursor.isNull(i2)) {
            return null;
        }
        return Long.valueOf(cursor.getLong(i2));
    }

    @Override // org.greenrobot.greendao.AbstractDao
    public NovelHistory readEntity(Cursor cursor, int i) {
        int i2 = i + 0;
        Long valueOf = cursor.isNull(i2) ? null : Long.valueOf(cursor.getLong(i2));
        int i3 = i + 1;
        String string = cursor.isNull(i3) ? null : cursor.getString(i3);
        int i4 = cursor.getInt(i + 2);
        int i5 = cursor.getInt(i + 3);
        int i6 = cursor.getInt(i + 4);
        int i7 = cursor.getInt(i + 5);
        int i8 = i + 6;
        String string2 = cursor.isNull(i8) ? null : cursor.getString(i8);
        int i9 = cursor.getInt(i + 7);
        int i10 = i + 8;
        int i11 = i + 9;
        return new NovelHistory(valueOf, string, i4, i5, i6, i7, string2, i9, cursor.isNull(i10) ? null : cursor.getString(i10), cursor.isNull(i11) ? null : this.tagListConverter.convertToEntityProperty(cursor.getString(i11)));
    }

    public void readEntity(Cursor cursor, NovelHistory novelHistory, int i) {
        int i2 = i + 0;
        List<String> list = null;
        novelHistory.setId(cursor.isNull(i2) ? null : Long.valueOf(cursor.getLong(i2)));
        int i3 = i + 1;
        novelHistory.setCoverImg(cursor.isNull(i3) ? null : cursor.getString(i3));
        novelHistory.setFakeLikes(cursor.getInt(i + 2));
        novelHistory.setFakeWatchTimes(cursor.getInt(i + 3));
        novelHistory.setFictionId(cursor.getInt(i + 4));
        novelHistory.setFictionSpace(cursor.getInt(i + 5));
        int i4 = i + 6;
        novelHistory.setFictionTitle(cursor.isNull(i4) ? null : cursor.getString(i4));
        novelHistory.setFictionType(cursor.getInt(i + 7));
        int i5 = i + 8;
        novelHistory.setInfo(cursor.isNull(i5) ? null : cursor.getString(i5));
        int i6 = i + 9;
        if (!cursor.isNull(i6)) {
            list = this.tagListConverter.convertToEntityProperty(cursor.getString(i6));
        }
        novelHistory.setTagList(list);
    }

    /* access modifiers changed from: protected */
    public final Long updateKeyAfterInsert(NovelHistory novelHistory, long j) {
        novelHistory.setId(Long.valueOf(j));
        return Long.valueOf(j);
    }

    public Long getKey(NovelHistory novelHistory) {
        if (novelHistory != null) {
            return novelHistory.getId();
        }
        return null;
    }

    public boolean hasKey(NovelHistory novelHistory) {
        return novelHistory.getId() != null;
    }
}
